-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I am writing a game for Facebook. IN the following code, I have a problem. I have a for loop executing, and in that loop, I call a dialog and implement 'onconfirm' for the dialog. The problem is that I need to access th e loop counter inside of the onconfirm function. But because the onconfirm is…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
Has anyone thought about why so many of us repeat this same pattern using the same variable names?
for (int i = 0; i < foo; i++) {
// ...
}
It seems most code I've ever looked at uses i, j, k and so on as iteration variables.
I suppose I picked that up from somewhere, but I wonder why…
>>> More
-
as seen on Programmers
- Search for 'Programmers'
Has anyone thought about why so many of us repeat this same pattern using the same variable names?
for (int i = 0; i < foo; i++) {
// ...
}
It seems most code I've ever looked at uses i, j, k and so on as iteration variables.
I suppose I picked that up from somewhere, but I wonder why…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Possible Duplicate:
Why are we using i as a counter in loops
I've used these myself for more than 15 years but cannot really remember how/where I picked up that habit. As it is really widespread, I'm curious to know who originally suggested / recommended using these names for integer loop counters…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
So I'm going through old code (2.0) and I came across this:
object isReviewingValue = ViewState["IsReviewing"];
if (isReviewingValue is bool)
{
return (bool)isReviewingValue;
}
My first thought was to us the "as" keyword to avoid the unneeded
(bool)isReviewingValue;
But "as" only works with…
>>> More